package com.company.clientscard.server.service;

import java.util.List;

import org.springframework.context.ApplicationContext;

import com.company.clientscard.server.domain.Client;

public class ClientController {
	private static ApplicationContext context;
	private static ClientService clientService;

	public ClientController() {
		context = Context.getContext();
		clientService = (ClientService) context.getBean(ClientService.class);
	}

	public void save(Client client) {
		clientService.save(client);
	}

	public Client findById(Long id) {
		return clientService.findById(id);
	}

	public Client update(Client client) {
		return clientService.update(client);
	}

	public List<Client> findAll() {
		return clientService.findAll(Client.class);
	}

	public List<Client> findAll(int firstRow, int numberOfRows) {
		return clientService.findAll(Client.class, firstRow, numberOfRows);
	}

	public List<Client> findWithParam(String paramName, Object param) {
		return clientService.findWithParam(Client.class, paramName, param);
	}
}
